package org.com.cis.cf.util;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Random;


public class TestSorter {
	public static void main(String args[])
	{
		Random rand = new Random();
		ArrayList<TestPoint> testList = new ArrayList<TestPoint>();
		for( int i = 0; i != 10; ++i) {
			testList.add(new TestPoint(i, rand.nextDouble()));
		}
		
		@SuppressWarnings("unchecked")
		Comparator<TestPoint> comp = new SortByTrue();
		Collections.sort(testList, comp);
		
		for( int i = 0; i != 10; ++i) {
			System.out.println(testList.get(i).getTrue() + "\t" + testList.get(i).getPredicted());
		}
		
		System.out.println("\n");
		
		@SuppressWarnings("unchecked")
		Comparator<TestPoint> comp2 = new SortByPredicted();
		Collections.sort(testList, comp2);
		
		for( int i = 0; i != 10; ++i) {
			System.out.println(testList.get(i).getTrue() + "\t" + testList.get(i).getPredicted());
		}
	}
}
